package nezumi.gui;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.font.FontRenderContext;
import java.awt.font.TextLayout;
import java.util.Map;

import nezumi.state.State;
import nezumi.state.SensorState;

public class SensorsEntity extends AEntity {

	public SensorsEntity(State state, Component enclosingComp) {
		super(state, enclosingComp);
	}

	public void draw(Graphics2D g) {

		FontRenderContext frc = g.getFontRenderContext();
		Font f = new Font("Helvetica", Font.BOLD, 14);
		final Map<String, Double> sstate = state.getSensorState().getState();
		String info = String.format(
				"OBST_LFT:%.1f, OBST_FRT:%.1f, OBST_RGT:%.1f, BEACON:%.1f",
				sstate.get(SensorState.IR_LFT), sstate.get(SensorState.IR_FRT),
				sstate.get(SensorState.IR_RGT), sstate.get(SensorState.BEACON));

		TextLayout tl = new TextLayout(info, f, frc);

		g.setColor(Color.GREEN);
		tl.draw(g, 10, 55);
	}
}
